package com.platform.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.platform.server.entity.TopicComment;
import com.platform.server.service.TopicService;

@Controller
@RequestMapping("/topic")
public class TopicController {
	
	@Autowired
	private TopicService topicService;
	
	/**
	 * 参与话题
	 */
	@ResponseBody
	@RequestMapping(value = "/joinTopic",method = RequestMethod.POST)
	public Object joinTopic(String topicid, String userid){
		return topicService.joinTopic(topicid,userid);
	}
	
	/**
	 * 话题点赞
	 */
	@ResponseBody
	@RequestMapping(value = "/topicLike",method = RequestMethod.POST)
	public Object topicLike(String topic_dynamic_id, String userid){
		return topicService.topicLike(topic_dynamic_id,userid);
	}
	
	/**
	 * 热门话题列表
	 */
	@ResponseBody
	@RequestMapping(value = "/hotTopicList",method = RequestMethod.POST)
	public Object hotTopicList(){
		return topicService.hotTopicList();
	}
	
	/**
	 * 话题详情
	 */
	@ResponseBody
	@RequestMapping(value = "/selectTopicInfo",method = RequestMethod.POST)
	public Object selectTopicInfo(Integer topicid,String userid){
		return topicService.selectTopicInfo(topicid,userid);
	}
	
	/**
	 * 发表话题评论
	 */
	@ResponseBody
	@RequestMapping(value = "/insertTopicComment",method = RequestMethod.POST)
	public Object insertTopicComment(String topicid,String userid,String content){
		return topicService.insertTopicComment(topicid,userid,content);
	}
	
	/**
	 * 发表话题动态评论
	 */
	@ResponseBody
	@RequestMapping(value = "/insertCommentPrimary",method = RequestMethod.POST)
	public Object insertCommentPrimary(TopicComment topicComment){
		return topicService.insertCommentPrimary(topicComment);
	}
	
	/**
	 * 查看评论消息列表
	 */
	@ResponseBody
	@RequestMapping(value = "/selectCommentList",method = RequestMethod.POST)
	public Object selectCommentList(String userid){
		return topicService.selectCommentList(userid);
	}
	
	/**
	 * 获取话题的推荐用户
	 */
	@ResponseBody
	@RequestMapping(value = "/selectTopicRecommendUser",method = RequestMethod.POST)
	public Object selectTopicRecommendUser(){
		return topicService.selectTopicRecommendUser();
	}
	
	/**
	 * 评论详情
	 */
	@ResponseBody
	@RequestMapping(value = "/selectCommentInfo",method = RequestMethod.POST)
	public Object selectCommentInfo(String topicid,String userid){
		return topicService.selectCommentInfo(topicid,userid);
	}
	
	/**
	 * 退出话题
	 */
	@ResponseBody
	@RequestMapping(value = "/exitTopic",method = RequestMethod.POST)
	public Object exitTopic(String topicid,String userid){
		return topicService.exitTopic(topicid,userid);
	}
	
	/**
	 * 个人资料详情
	 */
	@ResponseBody
	@RequestMapping(value = "/selectDatumDetails",method = RequestMethod.POST)
	public Object selectDatumDetails(Integer detailsUserid,String userid){
		return topicService.selectDatumDetails(detailsUserid,userid);
	}
	
	/**
	 * 删除话题评论
	 */
	@ResponseBody
	@RequestMapping(value = "/deleteTopicComment",method = RequestMethod.POST)
	public Object deleteTopicComment(Integer id,Integer type){
		return topicService.deleteTopicComment(id,type);
	}
	
}
